#!/bin/bash

CROSS_TOOLCHAIN="arm-none-eabi-"

export CC="${CROSS_TOOLCHAIN}gcc"
export AS="${CROSS_TOOLCHAIN}gcc -x assembler-with-cpp"
export CP="${CROSS_TOOLCHAIN}objcopy"
export SZ="${CROSS_TOOLCHAIN}size"

LDSCRIPT="${LITOS_PROJECT_DIR}/bsp/${LITOS_CHIP}/linkscript.ld"

export CFLAGS="${CHIP_CPU_FLAG} ${CHIP_DEFINES} -Og -Wall -fdata-sections -ffunction-sections"
export ASFLAGS="${CHIP_CPU_FLAG} ${AS_DEFS} ${AS_INCLUDES} ${OPT} -Og -Wall -fdata-sections -ffunction-sections"
export LIBS="-lc -lm -lnosys" 
export LDFLAGS="${CHIP_CPU_FLAG} -specs=nano.specs -T${LDSCRIPT} ${LIBDIR} ${LIBS} -Wl,-Map=${LITOS_PROJECT_DIR}/build/${LITOS_APP}.map,--cref -Wl,--gc-sections"


echo "build flag"